package main.java.FSMDE.styling;

import main.java.FSMDE.models.InterfaceType;
import main.java.FSMDE.models.TransitionType;

public class Styler {

	public static String getFillColor(InterfaceType type) throws Exception {
		switch (type) {
		case General:
			return StyleConstants.INTERFACE_GENERAL_COLOR;
		case Entry_form:
			return StyleConstants.INTERFACE_ENTRY_FORM_COLOR;
		case Output_form:
			return StyleConstants.INTERFACE_OUTPUT_FORM_COLOR;
		case Menu_context:
			return StyleConstants.INTERFACE_MENU_CONTEXT_COLOR;
		}

		throw new Exception();
	}

	public static String getFillColor(TransitionType type) throws Exception {
		switch (type) {
		case Control:
			return StyleConstants.TRANSITION_CONTROL_COLOR;
		case Functional:
			return StyleConstants.TRANSITION_FUNCTIONAL_COLOR;
		}

		throw new Exception();
	}

	public static String getStyle(String style, boolean containsSubdiagram) {
		String styleReturn = "";
		if (containsSubdiagram) {
			styleReturn = StyleConstants.INTERFACE_WITH_SUBDIAGRAM_STYLE;
		} else {
			if (style.equals("Start")) {
				styleReturn = StyleConstants.INTERFACE_STYLE_START;
			} else if (style.equals("End")) {
				styleReturn = StyleConstants.INTERFACE_STYLE_END;
			} else {
				styleReturn = StyleConstants.INTERFACE_STYLE;
			}
		}

		return styleReturn;
	}

	public static double getSizeRatio(int length) {
		if (length < 21)
			return 1;
		else {
			return 1 + (double) length / 80;
		}
	}
}
